package com.softcloud.comingforyuan.model;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.softcloud.comingforyuan.R;
import com.softcloud.comingforyuan.activity.MainActivity;

/**
 * Created by 喆歆 on 2015/6/29.
 */
public class TitleLayout extends LinearLayout{

    Button titleExit;
    Button titleToMain;

    public TitleLayout(final Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.title,this);
        titleExit = (Button)findViewById(R.id.title_exit);
        titleToMain = (Button)findViewById(R.id.title_toMain);

        titleExit.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityCollector.finishAll();
            }
        });

        titleToMain.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(context, MainActivity.class);
                context.startActivity(intent);
            }
        });
    }
}
